Einhugur macOS Bridge plugin.

NSOpenPanel.EnableURLDelegate Delegate

Delegate to be used with the SetURLEnableFilter method.

EnableURLDelegate(
   panel as EinhugurMacOSBridge.NSOpenPanel,
   url as EinhugurCoreBridge.NSURL) as Boolean

Parameters

panel
Handle to the Open panel.
url
The URL to be checked.

Returns

Boolean
You should return true if the URL should be selectable, else false.

Remarks

The delegate will be called for each URL in the Open panel, returning false will make the URL not selectable.

Implementations of this method should be fast to avoid stalling the user interface.


Public Function Filter(panel as EinhugurMacOSBridge.NSOpenPanel, url as EinhugurCoreBridge.NSURL) As Boolean
#Pragma DisableBackgroundTasks
#Pragma DisableBoundsChecking

ListBox1.AddRow(url.Path)

return not url.Path.EndsWith("test5.png")
End Function



In a more real world example your application could maintain Dictionary of currently open URLs, and prevent those from getting selected by quick dictionary lookup.

Note that if it will actually be selectable will also depend on the allowed file types set on the panel.

See Also

NSOpenPanel Class